from .exceptions import AabException
from .utils import jsonify_error
from .core import app


@app.errorhandler(500)
def handler(ex):
    return jsonify_error(500, message=str(ex))


@app.errorhandler(AabException)
def handler(ex: AabException):
    return ex.to_response()
